package com.game.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.game.enums.RoomStatus;

import lombok.Data;

@Data
public class Room {
    private String roomCode;
    private RoomStatus status;
    private Date createTime;
    private List<Player> players = new ArrayList<>();
    private Long currentPlayerId;
    private Long lastPlayerId;
    private List<String> lastPlayedCards = new ArrayList<>();
    private int currentRound;
    private int totalRounds;
    
    // 存储玩家提交的牌型
    private Map<Long, PlayerHands> submittedHands = new HashMap<>();
    
    // 存储每个玩家的得分
    private Map<Long, Integer> roundScores = new HashMap<>();
    
    // 判断是否所有玩家都已提交牌型
    public boolean allPlayersSubmitted() {
        return players.size() == submittedHands.size();
    }
    
    // 重置本轮数据
    public void resetRound() {
        submittedHands.clear();
        players.forEach(player -> player.setReady(false));
        // 清空本轮得分数据，避免前端混淆
        roundScores.clear();
    }
} 